{extend name="base/layout" /}


{block name="body"}
<article class="cl pd-20">
    <div class="cl pd-5 bg-1 bk-gray mt-5">
        <span class="l">
            {volist name="groupList" id="vo"}
            <a href="{:url('admin/Config/webset', ['groupid'=>$key])}" class="btn btn-primary radius"> {$vo}</a>
            {/volist}
        </span>
    </div>
    <form action="{:url('admin/Config/saveData')}" method="post" class="form form-horizontal" id="form-admin-edit">
        {volist name="list" id="config"}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>{$config.title}：</label>
            <div class="formControls col-xs-8 col-sm-7">
                <?php $disabled = $config->is_allow_change ? '' : 'disabled'; ?>
                {switch name="config.type"}
                {case value="0"}
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text"  name="config[{$config.name}]" value="{$config.value}" {$disabled}>
                    </div>
                {/case}
                {case value="1"}
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" name="config[{$config.name}]" value="{$config.value}" {$disabled}>
                    </div>
                {/case}
                {case value="2"}
                     <div class="formControls col-xs-8 col-sm-9">
                        <textarea class="textarea" name="config[{$config.name}]" {$disabled}>{$config.value}</textarea>
                     </div>
                {/case}
                {case value="3"}
                    <div class="formControls col-xs-8 col-sm-9">
                        <textarea class="textarea" name="config[{$config.name}]" {$disabled}>{$config.value}</textarea>
                    </div>
                {/case}
                {case value="4"}
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box">
                            <select class="select" name="config[{$config.name}]" {$disabled}>
                                {volist name=":parse_config_attr($config['extra'])" id="vo"}
                                    <option value="{$key}" {eq name="config.value" value="$key"}selected{/eq}>{$vo}</option>
                                {/volist}
                            </select>
                        </span>
                    </div>
                {/case}
                {/switch}

            </div>
            <div class="formControls col-xs-8 col-sm-3">{$config.remark}</div>
        </div>
        {/volist}

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-1">
                <input class="btn btn-primary radius" type="button" id="save-data" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
{/block}

{block name="script"}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#save-data").click(function () {
            $.ajax({
                type: 'POST',
                url: $("#form-admin-edit").attr('action'),
                dataType: 'json',
                data: $("#form-admin-edit").serialize(),
                success: function(result){
                    window.location.href = result.url;
                },
                error:function(result) {
                    layer.msg(result.msg);
                }
            });
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}